﻿Public Class MyListView

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        MyBase.OnPaint(e)

        'カスタム描画コードをここに追加します。
    End Sub
    '双击控件，触发事件
    Private Sub MyListView_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DoubleClick
        If Me.SelectedItems.Count > 0 Then
            RaiseEvent ItemClickRefreshData(Me.SelectedItems(0).Text)
        End If
    End Sub
    '选项改变，触发事件
    Private Sub MyListView_ItemSelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles Me.ItemSelectionChanged
        If Me.SelectedItems.Count > 0 Then
            RaiseEvent ItemClickRefreshData(Me.SelectedItems(0).Text)
        End If
    End Sub
    '控件大小改变触发事件，使第二列占控件的宽度-5
    Private Sub MyListView_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        If Me.Columns.Count > 1 Then
            Me.Columns(1).Width = Me.Width - 10
        End If
    End Sub

    '定义事件
    Public Event ItemClickRefreshData(ByVal strId As String)


End Class
